<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
</head>
<body>
    <div style="margin-top: 30px;margin-left: 30px;margin-right: 30px">
        <table class="layui-table" id="sort_list" lay-filter="sort_list">
        </table>
    </div>
</body>
<script>
    layui.use(['table'],function () {
        var table = layui.table;
        //第一个实例
        var tablein = table.render({
            elem: '#sort_list'
            ,skin:'line'
            ,url: '/sort_list' //数据接口
            ,where:{competition_id:getUrlParam("competitionId")}
            ,page: {theme:'#1e9fff'} //开启分页
            ,cellMinWidth:48
            ,cols: [[ //表头
                {type:'numbers', title: '排名',minWidth:50, align:'center',templet: function(d){
                        console.log(d);
                    }}
                ,{field: 'teamName', title: '队伍', minWidth:80, align:'center',templet: function(d){
                    if (d.LAY_INDEX == 1){
                        return '<span color="#ff0000">'+d.teamName+'</span>'
                    }
                        if (d.LAY_INDEX == 2){
                            return '<span color="#ff0000">'+d.teamName+'</span>'
                        }
                        if (d.LAY_INDEX == 3){
                            return '<span color="#ff0000">'+d.teamName+'</span>'
                        }
                        return d.teamName
                    }}
                ,{field: 'score', title: '得分', minWidth:50, align:'center',templet: function(d){
                        if (d.LAY_INDEX == 1){
                            return '<span color="#ff0000">'+d.score+'</span>'
                        }
                        if (d.LAY_INDEX == 2){
                            return '<span color="#ff0000">'+d.score+'</span>'
                        }
                        if (d.LAY_INDEX == 3){
                            return '<span color="#ff0000">'+d.score+'</span>'
                        }
                        return d.score
                    }}

            ]]
            ,parseData: function(res){ //res 即为原始返回的数据
                return {
                    "code": res.status, //解析接口状态
                    "msg": res.message, //解析提示文本
                    "count": res.total, //解析数据长度
                    "data": res.data //解析数据列表
                };
            }
        });
    });
</script>
</html>